Imports System.Data.SqlClient
Imports System.Data
Imports System.Windows.Forms
Imports System.Threading
Imports System.Drawing
Imports System.Data.OracleClient

Public Class ProjectConnection
    Public Function GetConnection() As SqlClient.SqlConnection
        Dim sDataSource, sDatabase, sUserID, sPassword As String
        Dim ds As New DataSet

        ds.ReadXml(Application.StartupPath & "\cnn.xml")
        Dim dr As DataRow = ds.Tables("cau_hinh").Rows(0)
        With dr
            sDataSource = Convert.ToString(.Item("datasource"))
            sDatabase = Convert.ToString(.Item("database"))
            sUserID = Convert.ToString(.Item("userid"))
            sPassword = Convert.ToString(.Item("password"))
        End With

        Dim myCnn As New SqlClient.SqlConnection
        myCnn.ConnectionString = "Database=" + sDatabase + ";UID=" + sUserID + ";PWD=" + sPassword + ";Server=" + sDataSource
        Return myCnn

    End Function

    Public Function GetConnection_Ora() As OracleClient.OracleConnection
        Dim sDatabase, sUserID, sPassword As String
        
        sDatabase = "CMIS2"
        sUserID = "CMIS02"
        sPassword = "CMIS02"

        Dim myCnn As New OracleClient.OracleConnection
        myCnn.ConnectionString = "server = " & sDatabase & ";user=" & sUserID & ";password=" & sPassword
        Return myCnn
    End Function


End Class

